package com.hsc.yalebao.tools;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Matrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import java.util.Hashtable;

public class QRCodeUtil
{
  public static Bitmap createImage(String paramString, int paramInt1, int paramInt2, Bitmap paramBitmap)
  {
    while (true)
    {
      int[] arrayOfInt;
      int k;
      try
      {
        Bitmap localBitmap1 = getScaleLogo(paramBitmap, paramInt1, paramInt2);
        int i = 0;
        int j = 0;
        if (localBitmap1 != null)
        {
          i = (paramInt1 - localBitmap1.getWidth()) / 2;
          j = (paramInt2 - localBitmap1.getHeight()) / 2;
        }
        Hashtable localHashtable = new Hashtable();
        localHashtable.put(EncodeHintType.CHARACTER_SET, "utf-8");
        BitMatrix localBitMatrix = new QRCodeWriter().encode(paramString, BarcodeFormat.QR_CODE, paramInt1, paramInt2, localHashtable);
        arrayOfInt = new int[paramInt1 * paramInt2];
        k = 0;
        if (k < paramInt2)
          break label288;
        Bitmap localBitmap2 = Bitmap.createBitmap(paramInt1, paramInt2, Bitmap.Config.ARGB_8888);
        localBitmap2.setPixels(arrayOfInt, 0, paramInt1, 0, 0, paramInt1, paramInt2);
        return localBitmap2;
        label123: if ((i != 0) && (j != 0) && (m >= i))
        {
          int i1 = i + localBitmap1.getWidth();
          if ((m < i1) && (k >= j))
          {
            int i2 = j + localBitmap1.getHeight();
            if (k < i2)
            {
              i3 = localBitmap1.getPixel(m - i, k - j);
              if (i3 == 0)
              {
                if (!localBitMatrix.get(m, k))
                  break label309;
                i3 = -16777216;
              }
              arrayOfInt[(m + k * paramInt1)] = i3;
              break label303;
            }
          }
        }
        if (localBitMatrix.get(m, k))
          arrayOfInt[(m + k * paramInt1)] = -16777216;
      }
      catch (WriterException localWriterException)
      {
        localWriterException.printStackTrace();
        return null;
      }
      int n = m + k * paramInt1;
      arrayOfInt[n] = -1;
      label288: label303: for (int m = 0; ; m++)
      {
        if (m < paramInt1)
          break label123;
        k++;
        break;
      }
      label309: int i3 = -1;
    }
  }

  private static Bitmap getScaleLogo(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    if (paramBitmap == null)
      return null;
    Matrix localMatrix = new Matrix();
    float f = Math.min(1.0F * paramInt1 / 5.0F / paramBitmap.getWidth(), 1.0F * paramInt2 / 5.0F / paramBitmap.getHeight());
    localMatrix.postScale(f, f);
    return Bitmap.createBitmap(paramBitmap, 0, 0, paramBitmap.getWidth(), paramBitmap.getHeight(), localMatrix, true);
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tools.QRCodeUtil
 * JD-Core Version:    0.6.2
 */